package com.volcreate.week2_3.no10;


import java.util.Scanner;

/**
 * @author zxc
 * @date 2020/9/23
 */
class Circle {
    private double radius;

    Circle(double radius) {
        this.radius = radius;
    }

    Circle() {
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public double getArea() {
        return (Math.PI * radius * radius);
    }

    public double getPerimeter() {
        return (Math.PI * 2 * radius);
    }

    @Override
    public String toString() {
        return "Circle(r:" + radius + ")";
    }
}

class Cylinder {
    private double height;
    Circle circle;

    public Cylinder(double height, Circle circle) {
        this.height = height;
        this.circle = circle;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public Circle getCircle() {
        return circle;
    }

    public void setCircle(Circle circle) {
        this.circle = circle;
    }

    double getArea() {
        return circle.getPerimeter() * height + 2 * circle.getArea();
    }

    double getVolume() {
        return circle.getArea() * height;
    }

    @Override
    public String toString() {
        return "Cylinder(h:" + height + ",Circle(r:" + circle.getRadius() + "))";
    }
}

public class Main {
    public static void main(String args[]) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        for (int i = 0; i < n; i++) {
            String str = input.next();
            if (str.equals("Circle")) {
                Circle c = new Circle(input.nextDouble());
                System.out.println("The area of " + c.toString() + " is " + String.format("%.2f", c.getArea()));
                System.out.println("The perimeterof " + c.toString() + " is " + String.format("%.2f", c.getPerimeter()));
            } else if (str.equals("Cylinder")) {
                Cylinder r = new Cylinder(input.nextDouble(), new Circle(input.nextDouble()));
                System.out.println("The area of " + r.toString() + " is " + String.format("%.2f", r.getArea()));
                System.out.println("The volume of " + r.toString() + " is " + String.format("%.2f", r.getVolume()));
            }
        }
    }
}